import request from '../utils/request';

// 审批中心相关API
export const approvalApi = {
  // 获取审批列表
  getApprovalList: (params) => {
    return request.get('/api/approvals', { params });
  },

  // 获取审批详情
  getApprovalDetail: (id) => {
    return request.get(`/api/approvals/${id}`);
  },

  // 审批通过
  approve: (id, data) => {
    return request.post(`/api/approvals/${id}/approve`, data);
  },

  // 审批拒绝
  reject: (id, data) => {
    return request.post(`/api/approvals/${id}/reject`, data);
  },

  // 获取项目审批列表
  getProjectApprovals: (params) => {
    return request.get('/api/approvals/projects', { params });
  },

  // 项目审批
  approveProject: (id, data) => {
    return request.post(`/api/approvals/projects/${id}/approve`, data);
  },

  // 项目审批拒绝
  rejectProject: (id, data) => {
    return request.post(`/api/approvals/projects/${id}/reject`, data);
  },

  // 获取离职审批列表
  getResignationApprovals: (params) => {
    return request.get('/api/approvals/resignations', { params });
  },

  // 离职审批
  approveResignation: (id, data) => {
    return request.post(`/api/approvals/resignations/${id}/approve`, data);
  },

  // 离职审批拒绝
  rejectResignation: (id, data) => {
    return request.post(`/api/approvals/resignations/${id}/reject`, data);
  },

  // 获取审批设置
  getApprovalSettings: () => {
    return request.get('/api/approvals/settings');
  },

  // 更新审批设置
  updateApprovalSettings: (data) => {
    return request.put('/api/approvals/settings', data);
  },

  // 获取我的审批
  getMyApprovals: (params) => {
    return request.get('/api/approvals/my', { params });
  },

  // 获取审批统计
  getApprovalStatistics: () => {
    return request.get('/api/approvals/statistics');
  }
};
